﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;

namespace SpaceInvaders
{
    public static class Menu
    {
        public static Texture2D background;
        static Icon instructions;
        static Icon exit;
        static Icon play;
        static Icon credits;
        static Icon scores;

        public static void Load(ContentManager content)
        {
            instructions = new Icon(content.Load<Texture2D>(@"Imagens\bot_instrucoes"), new Vector2(285, 250));
            exit = new Icon(content.Load<Texture2D>(@"Imagens\bot_Sair"), new Vector2(600, 350));
            play = new Icon(content.Load<Texture2D>(@"Imagens\bot_Jogar"), new Vector2(325, 150));
            credits = new Icon(content.Load<Texture2D>(@"Imagens\bot_creditos"), new Vector2(305, 350));
            scores = new Icon(content.Load<Texture2D>(@"Imagens\bot_Ranking"), new Vector2(60, 350));
            background = content.Load<Texture2D>(@"Imagens\intro");
        }

        public static void Update(MouseState mState)
        {
            if (mState.LeftButton == ButtonState.Pressed)
            {
                if (play.CheckMouse(mState))
                {

                    Ponto.ResetaPontuacao();
                    GerenciadorDeCena.faseAtual = EnumCenas.FASE1;
                    GerenciadorDeCena.fase[0].LoadEnemies();
                }
                if (instructions.CheckMouse(mState))
                {
                    GerenciadorDeCena.faseAtual = EnumCenas.INSTRUCOES;
                }
                if (credits.CheckMouse(mState))
                {
                    GerenciadorDeCena.faseAtual = EnumCenas.CREDITOS;
                }
                if (exit.CheckMouse(mState))
                {
                    Game1.exit = true;
                }
                if (scores.CheckMouse(mState))
                {
                    Ranking.LoadScores();
                    GerenciadorDeCena.faseAtual = EnumCenas.RANK;
                }
            }
        }

        public static void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(background, new Vector2(0, 0), Color.White);
            spriteBatch.Draw(play.texture, play.position, Color.White);
            spriteBatch.Draw(instructions.texture, instructions.position, Color.White);
            spriteBatch.Draw(credits.texture, credits.position, Color.White);
            spriteBatch.Draw(scores.texture, scores.position, Color.White);
            spriteBatch.Draw(exit.texture, exit.position, Color.White);
        }

        public static Icon VOLTAR { get; set; }

        public static Texture2D INSTRUCOES { get; set; }
    }
}
